package com.xdcplus.web.common.enums;

import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * 实时库存结算的工序，固定死的
 */
public enum QaOpeEnum {

    ZR( 1,"制绒",null,BdFactoryEnum.HP_FACTORY),
    PK(2,"硼扩",ZR,BdFactoryEnum.HP_FACTORY),
    LDSE( 3,"SE",PK,BdFactoryEnum.HP_FACTORY),
    YH(4,"氧化",LDSE,BdFactoryEnum.HP_FACTORY),
    BSG(5, "去BSG",YH,BdFactoryEnum.TOP_FACTORY),
    JP(6, "碱抛",BSG,BdFactoryEnum.TOP_FACTORY),
    LPCVD( 7,"LPCVD",JP,BdFactoryEnum.TOP_FACTORY),
    LK( 8,"磷扩",LPCVD,BdFactoryEnum.TOP_FACTORY),
    PSG(9, "去PSG",LK,BdFactoryEnum.TOP_FACTORY),
    RCA(10, "RCA",PSG,BdFactoryEnum.TOP_FACTORY),
    ALD( 11,"ALD",RCA,BdFactoryEnum.PE_FACTORY),
    PECVDZM( 12,"正膜",ALD,BdFactoryEnum.PE_FACTORY),
    PECVDBM( 13,"背膜",PECVDZM,BdFactoryEnum.PE_FACTORY),
    SWYS( 14,"丝印",PECVDBM,BdFactoryEnum.SY_FACTORY),
    ;


    private String desc;
    private Integer order;
    private QaOpeEnum lastEnum;

    public BdFactoryEnum getFactoryCode() {
        return factoryCode;
    }

    public void setFactoryCode(BdFactoryEnum factoryCode) {
        this.factoryCode = factoryCode;
    }

    private BdFactoryEnum factoryCode;
    QaOpeEnum(Integer order, String msg, QaOpeEnum lastEnum, BdFactoryEnum factoryCode) {
        this.desc = msg;
        this.order=order;
        this.lastEnum=lastEnum;
        this.factoryCode=factoryCode;
    }
    public String getDesc() {
        return desc;
    }

    public QaOpeEnum getLastEnum() {
        return lastEnum;
    }

    public void setLastEnum(QaOpeEnum lastEnum) {
        this.lastEnum = lastEnum;
    }

    public Integer getOrder() {
        return order;
    }

    public static List<QaOpeEnum> sortByValue() {
        return Stream.of(values())
                .filter(realStockSettlementOpeEnum -> realStockSettlementOpeEnum.getOrder()>-1)
                .sorted(Comparator.comparingInt(QaOpeEnum::getOrder))
                .collect(Collectors.toList());
    }



}
